package com.xpqh.ksg.modular.periphery.service;

import com.xpqh.ksg.common.persistence.dao.KsgProductPeripheryMapper;
import com.xpqh.ksg.modular.periphery.dto.KsgProductPeripheryDetailsRespDTO;
import com.xpqh.ksg.modular.periphery.dto.KsgProductPeripheryListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Service
public class PeripheryService {

    @Autowired
    private KsgProductPeripheryMapper ksgProductPeripheryMapper;

    public List<KsgProductPeripheryListDTO> getProductPeripheryList(String searchContent,String order, String label, Integer pageNo, Integer pageSize) {
        return ksgProductPeripheryMapper.getProductPeripheryList(searchContent,order, label, (pageNo - 1) * pageSize, pageSize);
    }

    public KsgProductPeripheryDetailsRespDTO getProductPeripheryDetails(String autoId) {
        return ksgProductPeripheryMapper.getProductPeripheryDetails(autoId);
    }

    public void doLike(@NotBlank(message = "周边商品ID不能为空") String autoId) {
        ksgProductPeripheryMapper.doLike(autoId);
    }
}

